package edu.ntu.cloudroid.nongui.com;

import java.net.URI;
import java.util.ArrayList;
import java.util.List;

import com.sun.xacml.attr.DoubleAttribute;
import com.sun.xacml.attr.StringAttribute;
import com.sun.xacml.ctx.Attribute;

import edu.ntu.cloudroid.xacml.XACMLStrings;

/**
 * @author anhdinh
 * Include the user's coordinates in the request
 */
public class LocationRequestWithInputs extends RequestNoInputs{

	private double longitude=-1, latitude=-1;	
	
	public LocationRequestWithInputs(String requesterID, String requestedID,
			double longtitude, double latitude) {
		super(requesterID, requestedID);		
		this.latitude = latitude;
		this.longitude = longtitude;			
	}
	
	
	public LocationRequestWithInputs(String requesterID, 
			double longtitude, double latitude, String placeName) {
		super(requesterID);
		this.latitude = latitude;
		this.longitude = longtitude;	
	}
			
	@Override
	public List<Attribute> getInputAttributes() throws Exception{
		List<Attribute> list = new ArrayList<Attribute>();
		
		 // add the subject's latitude
	      list.add(new Attribute(new URI(XACMLStrings.ATTR_Latitude), null,
	            null, new DoubleAttribute(latitude)));

	      // add the subject's longitude
	      list.add(new Attribute(new URI(XACMLStrings.ATTR_Longitude), null,
	            null, new DoubleAttribute(longitude)));	      	     
		return list;
	}


	public double getLongtitude() {
		return longitude;
	}


	public double getLatitude() {
		return latitude;
	}

	
}
